package com.ushine.web.template.mybatis.controller;

import com.ushine.web.component.http.HttpResponseVO;
import com.ushine.web.log.annotation.SystemControllerLog;
import com.ushine.web.log.constant.LogConstant;
import com.ushine.web.template.mybatis.service.impl.MapFunctionServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author: yls
 * @Date 2022/2/8 13:48
 * @Description: Map + 函数式接口的示例
 * @Version 1.0
 **/
@RestController
@RequestMapping("component/function")
@Api(tags = "组件模块-函数式接口测试")
public class MapFunctionController {

    @Resource
    private MapFunctionServiceImpl mapFunctionService;

    @SystemControllerLog(operation = LogConstant.READ)
    @ApiOperation("根据类型获取对应的结果")
    @GetMapping("getByType/{type}")
    public HttpResponseVO<Object> getTypeResult(@PathVariable Integer type) {
        String result = mapFunctionService.getResultByTypeName(type, "");
        return new HttpResponseVO<>().ok(result);
    }
}
